package com.kin207.netty.util;

import org.apache.commons.lang3.StringUtils;

public class CommonUtils {
	/**
	 * 获取随机数
	 * @param r
	 * @return
	 */
	public static String roundNumToHex16(int r) {
		int roundNum = (int) Math.pow(2, 16);
		long num = (long) (Math.random()*(roundNum+1));
		String resluts = StringUtils.leftPad(num+"", 5,"0").toString();
		return HexUtils.toHexL(resluts, r);
	}
	/**
	 * 校验和
	 * @param length
	 * @return
	 */
	public static int getCheckNum(int length) {
		return length & 0xFF;
	}
	public static void main(String[] args) {
		System.out.println((roundNumToHex16(4)+""));
	}
}
